{include file="./headStart.tpl"}
<script type="text/javascript">
$(document).ready(function() 
{
  // To change nextAction : Starts
  $(".nextAction").change(function(){
    nextActionPlan($(this));
  });
   // To change nextAction : End
  $(".add").click(function(){ 
    $("#one").clone(true).appendTo("#mainDiv").find('textarea').val('');    
    nextActionPlan($(this));
    addRow();
  });
});
function nextActionPlan(theObj)
{
  if($(theObj).val() == 1)
  {
    $(theObj).next("span").show();    
    var dataString = "typeOfConclusionId=" + $(theObj).val();
    $.ajax({
      url: "./conclusionAj.php",
      cache: false,
      data: dataString,
      success:function(data){
        $(theObj).next("span").html(data);
      }
    });
  }
  else
  {
    $(theObj).next("span").hide();    
  }
}
function addRow() 
{
  var countSr = 1;
  $('.srNoClass').each(function()
  {
    this.value = countSr++;
  });
  return false;
}

function deleteRow() 
{
  var countSr = 1;
    $('.delete').click(function()
    {
      $(this).parent().parent().remove();
      $('.srNoClass').each(function()
      {
        this.value = countSr++;
      });
        return false;
     });
}
</script>
{include file="./headEnd.tpl"}
Today's Date : {$currentCreateDate}
<form name="form1" action="{$smarty.server.PHP_SELF}" id="form1" method="post">
<input type="hidden" name="dailyReportMasterId" value="{$dailyReportMasterId}" /> 

<table align="center" border="1" cellpadding="2" cellspacing="1" >
<tr>
  <td align="center" class="table1" colspan="6">Daily Report</td>
</tr>
<tr>
  <td align="left" class="table2">User : </td>
  <td class="table2">
    <select name="userId" id="userId" disabled="disabled">
      <option>Name</option>
      {html_options values=$userId output=$userName selected=$userSelected}
     </select>
  </td>
  <td align="right" class="table2" >For The Date : </td>
    <td NOWRAP class="table2">
      {html_select_date day_format="$reportDateSelected" prefix="reportDate" start_year="-3" end_year="+1" month_format="%m" field_order="DMY" day_value_format="%02d" disabled="disabled"}
    </td>
</tr>
</table><br />
<table align="center" border="1"  cellpadding="1" cellspacing="0">
<tr>
  <td colspan="4"> 
    <table align="center" border="0" id="dataTable" width="100" cellpadding="2" cellspacing="0">
      <tr>
        <th class="table1" align="center">SR. NO.</th>
        <th class="table1" align="center">Customer</th>
        <th class="table1" align="center">Outcome</th>
        <th class="table1" align="center">Conclusion</th>
       <!-- <td class="table1" align="center"><B>NextFollowUp Date</td>
        <td class="table1" align="center"><B>Remarks</td>-->
      </tr>
        {section name="sec" loop=$dailyReportDetailArray}
         <tr>
            <td class="table2" align="center">{$dailyReportDetailArray[sec].rownum}</td>
            <td class="table2" align="center" NOWRAP>{$dailyReportDetailArray[sec].companyName}</td>
            <td class="table2" align="center" NOWRAP>{$dailyReportDetailArray[sec].outCome}</td>
            <td class="table2" align="center" NOWRAP>{$dailyReportDetailArray[sec].typeOfConclusion}</td>
            {if $dailyReportDetailArray[sec].typeOfConclusionId ==1}
         <!--   <td class="table2" align="center" NOWRAP>{$dailyReportDetailArray[sec].nextFollowUp}</td>
            <td class="table2" align="center" NOWRAP>{$dailyReportDetailArray[sec].remarks}</td> -->
            {/if}
          </tr>
        {/section}
    </table>
  </td>   
</tr>
</table>
<br/>

<table align="center" border="1"  cellpadding="1" cellspacing="0">
<tr>
  <td colspan="4"> 
    <table align="center" border="0" id="dataTable" width="100" cellpadding="2" cellspacing="0">
      <tr>
        <th class="table1" align="center">SR. NO.</th>
        <th class="table1" align="center" colspan="1">Customer</th>
        <th class="table1" align="center">Outcome</th>
        <th class="table1" align="center">Conclusion</th>
        <td class="table1" align="center"><B>&nbsp;</td>
        <td class="table1" align="center"><B>&nbsp;</td>
      </tr>
      <td></td>
      <tbody id="mainDiv">
        <tr id="one">
          <td class="table2" width=""><input type="text" class="srNoClass" name="srNo[]" size="5" value="1" DISABLED></td>
          <td class="table2"><select name="partyId[]" id="partyId"><option>Name</option>{html_options values=$partyId output=$companyName}</select> </td>
          <td class="table2"><textarea name="outCome[]"  rows="1" cols="60">{$outCome}</textarea></td>
          <td class="table2" NOWRAP>
            <select name="typeOfConclusionId[]" id="typeOfConclusionId" class="nextAction">
              <option value=0 >Select</option>
              {html_options values=$typeOfConclusionId output=$typeOfConclusion}
            </select>
            <span></span>
          </td>
          <td class="table2"><input type="button" name="add"  class="add" value="Add"/></td>
          <td class="table2"><input type="button" value="Delete" name="deleteBtn"  class="delete" onclick="deleteRow()"/></td>
        </tr>
      </tbody>
    </table>    
    </table>
    <br/>
    
<table border="1" align="center">
	<tr>
	  <td align="center" class="table1">Market Feedback</td>
    <td align="center" class="table1">Competitor Information</td>
  </tr>
  <tr>
	  <td align="center" class="table1"><textarea name="marketFeedback" rows="3" cols="55">{$marketFeedbackSelected}</textarea></td>
    <td align="center" class="table1"><textarea name="compInformation" rows="3" cols="55">{$compInformationSelected}</textarea></td>
  </tr>
</table>

<table border="0" align="center">
  <tr>
    <td align="center" colspan="3">
      <input type="submit" value="SUBMIT" name="submitBtn" />
      <input type="submit" value="CANCEL" name="cancelBtn" />
    </td>
  </tr>
</table>
</form>
{include file="footer.tpl"}